package com.media.Media;

import com.media.Media.R;
import com.media.util.NetTool;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class Upload extends Activity {
	private TextView tvData = null;	
	private Button btnUploadFile = null;

    private String localHost = "http://192.168.8.249:8080";
	
	private String uploadUrl = "http://59.64.176.73:8080/U_server/FileUploadServlet/param?name=111";
	private String videoPath = "/sdcard/A_VideoTest/";
	private String name ; 


	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.upload);
   //     name = "iVideo.3gp";
		tvData = (TextView) findViewById(R.id.tvData);
   
		Bundle bundle = this.getIntent().getExtras();
		name = bundle.getString("KEY_NAME");
		
		btnUploadFile = (Button) findViewById(R.id.btnUploadFile);
		btnUploadFile.setOnClickListener(btnListener);
	

	}

	OnClickListener btnListener = new OnClickListener() {
		String retStr = "";

	
		public void onClick(View v) {
			
			   String filePath = videoPath + name ;
			
				try {
					retStr = NetTool.sendFile(uploadUrl, filePath,
							name);
				} catch (Exception e) {
					e.printStackTrace();
				}
			
		
			tvData.setText(retStr);
		}
	};
	
	
	
}